// JavaScript Document
function register(){
	var loc_username=document.getElementById("username").value;
	var loc_password=document.getElementById("password").value;
	var loc_confirm_password=document.getElementById("confirm_password").value;
	
    if(loc_username=="" || loc_password=="" ||loc_confirm_password==""){
     //alert("请输入username！！");
     document.getElementById("username").focus();
     document.getElementById("login_message").innerHTML="用户名或密码不能为空！";
     return false;
    }else if(loc_password != loc_confirm_password){
		//alert("两次输入的密码不一样！");
        document.getElementById("confirm_password").focus();
        document.getElementById("login_message").innerHTML="两次输入的密码不一样！";
		return false;
    }
	else{
		 //alert(loc_password != loc_confirm_password);
		 r_ajax_check1(document.getElementById("username").value,document.getElementById("password").value);
	}
}
function r_ajax_check1(username,password){
	//alert("username:"+username+",password:"+password+".");
	tb_remove();
}

function r_ajax_check(username,password){
   var url = "ajaxLogin.php?username=" + username + "&password=" + password;
   var xmlHttp = false;
   if (window.ActiveXObject) {
     xmlHttp = new ActiveXObject("MsXml2.XmlHttp");
   } else {
     xmlHttp = new XMLHttpRequest();
   }
   xmlHttp.open("GET", url, false);
   xmlHttp.setRequestHeader("If-Modified-Since","0"); //解决缓存问题;不缓存数据
   xmlHttp.send(null);

   var text = xmlHttp.responseText;
   if(text=='true'){
     document.getElementById("tip").innerHTML="您已经登录了-" + text;
     tb_remove();
   }else{
     document.getElementById("tip").innerHTML="错误的用户名-" + text;
     document.getElementById("tkp").innerHTML="<font color=red>错误的用户名</font>:" + text;
   }
}